package com.sql.helper;

import android.content.Context;
import android.database.DatabaseErrorHandler;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class DBHelper extends SQLiteOpenHelper {

	public DBHelper(Context context) {
		//name:数据库名称
		//factory:游标工厂，指定从数据库中查询到的结果集的游标类型-->取null
		//version:版本为>0的整数
		super(context, "mysql.db", null, 1);
	}

	//在应用第一次创建数据库时调用，且只会被调用一次
	@Override
	public void onCreate(SQLiteDatabase db) {
		//适合做一些初始化过程
		//"create table star(sid integer primary key autoincrement,name varchar(20),age integer)"
        db.execSQL("create table student(sid integer primary key autoincrement, name varchar(20) ,age integer,sex varchar(10))");
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub

	}

}
